package exam.huatai.S3;

import java.util.*;

public class Main {

    public static int n;
    public static int k;
    public static int d;
    public static int[] nums;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = sc.nextInt();
        }
        k = sc.nextInt();
        d = sc.nextInt();
        System.out.println(solution());
    }

    private static int solution() {
        int[][] mindp = new int[n+1][k+1], maxdp = new int[n+1][k+1];
        for (int j=0; j<=k; ++j) {
            mindp[0][j] = 1;
            maxdp[0][j] = 1;
        }
        for (int i=1; i<=n; ++i) {
            mindp[i][0] = 1;
            maxdp[i][0] = 1;
        }
        for (int i=1; i<=n; ++i) {
            for (int j=1; j<=k && j<=i; ++j) {
                int maxVal = Integer.MIN_VALUE, minVal = Integer.MAX_VALUE;
                for (int t=Math.max(0, i-d); t<i; ++t) {
                    if (j > 1 && t == 0)
                        continue;
                    maxVal = Math.max(maxVal, Math.max(nums[i-1]*maxdp[t][j-1], nums[i-1]*mindp[t][j-1]));
                    minVal = Math.min(minVal, Math.min(nums[i-1]*maxdp[t][j-1], nums[i-1]*mindp[t][j-1]));
                }
                maxdp[i][j] = maxVal;
                mindp[i][j] = minVal;
            }
        }
        int res = Integer.MIN_VALUE;
        for (int i=k; i<=n; ++i) {
            res = Math.max(res, maxdp[i][k]);
        }
        return res;
    }
}